home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Framewrk / FWViews / FWContrl.cpp < prev    next >
Encoding:
Text File  |  1996-09-17  |  20.6 KB  |  681 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWControl.cpp
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "FWFrameW.hpp"
  11.  
  12. #ifndef FWCONTRL_H
  13. #include "FWContrl.h"
  14. #endif
  15.  
  16. #ifndef FWFRAME_H
  17. #include "FWFrame.h"
  18. #endif
  19.  
  20. #ifndef FWUTIL_H
  21. #include "FWUtil.h"
  22. #endif
  23.  
  24. #ifndef FWCONTXT_H
  25. #include "FWContxt.h"
  26. #endif
  27.  
  28. #ifndef FWITERS_H
  29. #include "FWIters.h"
  30. #endif
  31.  
  32. // ----- Foundation Layer -----
  33.  
  34. #ifndef FWRECEVR_H
  35. #include "FWRecevr.h"
  36. #endif
  37.  
  38. #ifndef FWSOMENV_H
  39. #include "FWSOMEnv.h"
  40. #endif
  41.  
  42. // ----- OS Layer -----
  43.  
  44. #ifndef FWCURSOR_H
  45. #include "FWCursor.h"
  46. #endif
  47.  
  48. #ifndef FWEVENT_H
  49. #include "FWEvent.h"
  50. #endif
  51.  
  52. #ifndef FWGRUTIL_H
  53. #include "FWGrUtil.h"
  54. #endif
  55.  
  56. #ifndef FWODGEOM_H
  57. #include "FWODGeom.h"
  58. #endif
  59.  
  60. #ifndef FWFCTINF_H
  61. #include "FWFctInf.h"
  62. #endif
  63.  
  64. #ifndef FWWINDOW_H
  65. #include "FWWindow.h"
  66. #endif
  67.  
  68. #ifndef FWNOTDEF_H
  69. #include "FWNotDef.h"
  70. #endif
  71.  
  72. // ----- OpenDoc Includes -----
  73.  
  74. #ifndef SOM_ODFacet_xh
  75. #include <Facet.xh>
  76. #endif
  77.  
  78. #ifndef SOM_ODCanvas_xh
  79. #include <Canvas.xh>
  80. #endif
  81.  
  82. #ifndef SOM_ODTransform_xh
  83. #include <Trnsform.xh>
  84. #endif
  85.  
  86. //========================================================================================
  87. // Runtime Informations
  88. //========================================================================================
  89.  
  90. #ifdef FW_BUILD_MAC
  91. #pragma segment fwgadgts
  92. #endif
  93.  
  94. //========================================================================================
  95. // Forward declarations
  96. //========================================================================================
  97.  
  98.  
  99. //========================================================================================
  100. // CLASS FW_CControl
  101. //========================================================================================
  102.  
  103. FW_DEFINE_CLASS_M2(FW_CControl, FW_CView, FW_MNotifier)
  104.  
  105. //----------------------------------------------------------------------------------------
  106. // FW_CControl::FW_CControl
  107. //----------------------------------------------------------------------------------------
  108.  
  109. FW_CControl::FW_CControl(Environment* ev, 
  110.                     FW_CSuperView* container,
  111.                     const FW_CRect& bounds,
  112.                     ODID viewID,
  113.                      FW_Message msg,
  114.                      FW_ControlValue value) :
  115.     FW_CView(ev, container, bounds, viewID),
  116.     FW_MNotifier(),
  117.     fMessage(msg),
  118.     fValue(value)
  119. {
  120. }
  121.  
  122. //----------------------------------------------------------------------------------------
  123. // FW_CControl::FW_CControl
  124. //----------------------------------------------------------------------------------------
  125.  
  126. FW_CControl::FW_CControl(Environment* ev) :
  127.     FW_CView(ev),
  128.     FW_MNotifier(),
  129.     fMessage(0),
  130.     fValue(0)
  131. {
  132. }
  133.  
  134. //----------------------------------------------------------------------------------------
  135. // FW_CControl::~FW_CControl
  136. //----------------------------------------------------------------------------------------
  137.  
  138. FW_CControl::~FW_CControl()
  139. {
  140. }
  141.  
  142. //----------------------------------------------------------------------------------------
  143. //    FW_CControl::AdjustCursor
  144. //----------------------------------------------------------------------------------------
  145.  
  146. FW_Handled FW_CControl::AdjustCursor(Environment *ev, ODFacet* odFacet, const FW_CPoint& theMousePoint, ODEventInfo* eventInfo)
  147. {
  148. FW_UNUSED(ev);
  149. FW_UNUSED(odFacet);
  150. FW_UNUSED(theMousePoint);
  151. FW_UNUSED(eventInfo);
  152.  
  153.     FW_gArrowCursor.Select();
  154.     return FW_kHandled;
  155. }
  156.  
  157. //----------------------------------------------------------------------------------------
  158. //    FW_CControl::LinkControlTo
  159. //----------------------------------------------------------------------------------------
  160.  
  161. void FW_CControl::LinkControlTo(Environment *ev, FW_MReceiver* receiver)
  162. {    
  163.     receiver->AddInterest(FW_CInterest(this, GetMessage(ev)));
  164. }
  165.  
  166. //----------------------------------------------------------------------------------------
  167. //    FW_CControl::SetValue
  168. //----------------------------------------------------------------------------------------
  169.  
  170. void FW_CControl::SetValue(Environment* ev, FW_ControlValue value)
  171. {
  172.     if (value != fValue)
  173.     {
  174.         fValue = value;
  175.         
  176.         // Notify the control's receivers that its value changed
  177.         
  178.         if (fMessage != FW_kNullMsg)
  179.             Notify(ev, FW_CControlNotification(this));
  180.     }
  181. }
  182.  
  183. //----------------------------------------------------------------------------------------
  184. //    FW_CControl::PrivSetValue
  185. //----------------------------------------------------------------------------------------
  186.  
  187. FW_Boolean FW_CControl::PrivSetValue(Environment*, FW_ControlValue value, ODFacet*)
  188. {
  189.     if (fValue == value)
  190.         return false;
  191.         
  192.     fValue = value;
  193.     return true;
  194. }
  195.  
  196. //----------------------------------------------------------------------------------------
  197. //    FW_CControl::SetMessage
  198. //----------------------------------------------------------------------------------------
  199.  
  200. void FW_CControl::SetMessage(Environment* ev, FW_Message msg)
  201. {
  202. FW_UNUSED(ev);
  203.     fMessage = msg;
  204. }
  205.  
  206. //----------------------------------------------------------------------------------------
  207. //    FW_CControl::Flatten
  208. //----------------------------------------------------------------------------------------
  209.  
  210. void    FW_CControl::Flatten(Environment*ev, FW_CWritableStream& stream) const
  211. {
  212.     FW_CView::Flatten(ev, stream);
  213.     
  214.     // Find out what receiverKind should be written out. Try the SuperView then the Frame
  215.     short receiverKind = 0;
  216.     FW_CView* view = GetSuperView(ev);
  217.     FW_MReceiver* receiver = FW_DYNAMIC_CAST(FW_MReceiver, view);
  218.     FW_MNotifier* notifier = (FW_MNotifier*)this;
  219.     FW_CInterest interest(notifier, GetMessage(ev));
  220.     
  221.     if (receiver != NULL && notifier->IsConnectedTo(receiver, interest) )
  222.     {
  223.         receiverKind = FW_kViewReceiver;
  224.     }
  225.     else if (view->IsFrame(ev) == false)
  226.     {
  227.         view = GetFrame(ev);
  228.         FW_MReceiver* receiver = FW_DYNAMIC_CAST(FW_MReceiver, view);
  229.         if (receiver != NULL && notifier->IsConnectedTo(receiver,interest))
  230.         {
  231.             receiverKind = FW_kFrameReceiver;
  232.         }
  233.     }    
  234.  
  235.     stream << fMessage << receiverKind << fValue;
  236. }
  237.  
  238. //----------------------------------------------------------------------------------------
  239. //    FW_CControl::InitializeFromStream
  240. //----------------------------------------------------------------------------------------
  241.  
  242. void    FW_CControl::InitializeFromStream(Environment*ev, FW_CReadableStream& stream)
  243. {
  244.     FW_CView::InitializeFromStream(ev, stream);
  245.     
  246.     short receiverKind;
  247.  
  248.     stream >> fMessage >> receiverKind >> fValue;
  249.  
  250.     FW_ASSERT(receiverKind >= 0 && receiverKind <= FW_kFrameReceiver);
  251.     
  252.     // Connection to a receiver
  253.     if (receiverKind == FW_kViewReceiver || receiverKind == FW_kFrameReceiver)
  254.     {        
  255.         FW_CView* view = (receiverKind == FW_kViewReceiver) ? GetSuperView(ev) : 
  256.                                                                 GetFrame(ev);
  257.                                                                 
  258.         // We check that the view is a valid receiver before linking the control
  259.         FW_MReceiver* receiver = FW_DYNAMIC_CAST(FW_MReceiver, view);
  260.         if (receiver == NULL)
  261.         {
  262.             // If you get this error:
  263.             //  -1- Make sure that the view or frame class you want to link to this control 
  264.             //        inherits from FW_MReceiver.
  265.             //  -2- Make sure that you use a RTTI macro FW_DEFINE_CLASS_Mx, like:
  266.             //            FW_DEFINE_CLASS_M2(MyFrame, FW_CFrame, FW_MReceiver)
  267.             //    (See also ODF samples)
  268.             FW_DEBUG_MESSAGE("Your view or frame is not a FW_MReceiver, or you forgot RTTI macros");    
  269.         }
  270.         else
  271.             LinkControlTo(ev, receiver);
  272.     }
  273. }
  274.  
  275. //========================================================================================
  276. // CLASS FW_CNativeControl
  277. //========================================================================================
  278.  
  279. FW_DEFINE_CLASS_M1(FW_CNativeControl, FW_CControl)
  280.  
  281. //----------------------------------------------------------------------------------------
  282. // FW_CNativeControl::FW_CNativeControl
  283. //----------------------------------------------------------------------------------------
  284.  
  285. FW_CNativeControl::FW_CNativeControl(Environment* ev, 
  286.                     FW_CSuperView* container,
  287.                     const FW_CRect& bounds,
  288.                     ODID viewID,
  289.                      FW_Message msg,
  290.                      FW_ControlValue value) :
  291.     FW_CControl(ev, container, bounds, viewID, msg, value),
  292.     fControlHelper(NULL)
  293. {
  294.     
  295. }
  296.  
  297. //----------------------------------------------------------------------------------------
  298. // FW_CNativeControl::FW_CNativeControl
  299. //----------------------------------------------------------------------------------------
  300.  
  301. FW_CNativeControl::FW_CNativeControl(Environment* ev) :
  302.     FW_CControl(ev),
  303.     fControlHelper(0)
  304. {
  305. }
  306.  
  307. //----------------------------------------------------------------------------------------
  308. // FW_CNativeControl::~FW_CNativeControl
  309. //----------------------------------------------------------------------------------------
  310.  
  311. FW_CNativeControl::~FW_CNativeControl()
  312. {
  313. }
  314.  
  315. //----------------------------------------------------------------------------------------
  316. // FW_CNativeControl::GetLabel
  317. //----------------------------------------------------------------------------------------
  318.  
  319. void    FW_CNativeControl::GetLabel(Environment* ev, FW_CString& label) 
  320. {
  321. FW_UNUSED(ev);
  322. #ifdef FW_BUILD_MAC
  323.     fControlHelper->GetText(label);
  324. #else
  325.     FW_UNUSED(label);
  326. #endif
  327. }
  328.  
  329. //----------------------------------------------------------------------------------------
  330. // FW_CNativeControl::SetLabel
  331. //----------------------------------------------------------------------------------------
  332.  
  333. void FW_CNativeControl::SetLabel(Environment* ev, const FW_CString& label, FW_ERedrawVerb redraw) 
  334. {
  335. #ifdef FW_BUILD_MAC
  336.     fControlHelper->SetText(label);        // change title without redraw
  337. #endif
  338.  
  339.     if (redraw == FW_kInvalidate)
  340.         Invalidate(ev);
  341. }
  342.  
  343. //----------------------------------------------------------------------------------------
  344. // FW_CNativeControl::GetPlatformControlHandle
  345. //----------------------------------------------------------------------------------------
  346.  
  347. FW_PlatformHandle FW_CNativeControl::GetPlatformControlHandle(Environment* ev) const
  348. {
  349. FW_UNUSED(ev);
  350. #ifdef FW_BUILD_MAC
  351.     return (FW_PlatformHandle)fControlHelper->GetControlHandle();
  352. #endif
  353. #ifdef FW_BUILD_WIN
  354.     return fControlHelper->fHWnd;
  355. #endif
  356. }
  357.  
  358. //----------------------------------------------------------------------------------------
  359. // FW_CNativeControl::SetValue
  360. //----------------------------------------------------------------------------------------
  361.  
  362. void FW_CNativeControl::SetValue(Environment *ev, FW_ControlValue value)
  363. {
  364.     // This is not called in response of a mousedown event, the facet is NULL
  365.     PrivSetValue(ev, value, NULL);
  366. }
  367.  
  368. //----------------------------------------------------------------------------------------
  369. //    FW_CNativeControl::PrivSetValue
  370. //----------------------------------------------------------------------------------------
  371.  
  372. FW_Boolean FW_CNativeControl::PrivSetValue(Environment* ev, FW_ControlValue value, 
  373.                                                                 ODFacet* curFacet)
  374. {
  375.     short min = fControlHelper->GetMin();
  376.     short max = fControlHelper->GetMax();
  377.  
  378.     if (value < min)
  379.         value = min;
  380.     if (value > max)
  381.         value = max;        
  382.         
  383.     // Update base class value or return false if value is the same
  384.     if (FW_CControl::PrivSetValue(ev, value, curFacet) == false)
  385.         return false;
  386.     
  387.     FW_CPlatformPoint qdSize    = GetSize(ev).AsPlatformPoint();
  388.     
  389.     // If subviews are already created SetValue will trigger some drawing
  390.     if (GetFrame(ev)->PrivSubViewsCreated(ev))
  391.     {
  392.         // During a mousedown event the view context & control are already set up
  393.         // so we can update the control more quickly in the current facet
  394.         if (curFacet != NULL)
  395.             fControlHelper->SetValue(value, true);    
  396.  
  397.         // Update the controls in each remaining facet if any
  398.         FW_CFrameFacetIterator ite(ev, GetFrame(ev));
  399.         for  (ODFacet* facet = ite.First(ev); ite.IsNotComplete(ev); facet = ite.Next(ev))
  400.         {
  401.             if (facet == curFacet) continue;
  402.  
  403.             FW_CViewContext vc(ev, this, facet);
  404.             FW_CPlatformPoint qdPoint    = vc.LogicalToDevice(FW_kZeroPoint);
  405.             fControlHelper->SetValue(value, qdPoint, qdSize);
  406.         }
  407.     }
  408.     else
  409.     {
  410.         // If SetValue is called during the initial creation of subviews we want to
  411.         // avoid any drawing before the whole facet is updated
  412.         fControlHelper->SetValue(value, false);
  413.     }
  414.     
  415.     return true;
  416. }
  417.  
  418. //----------------------------------------------------------------------------------------
  419. // FW_CNativeControl::Draw
  420. //----------------------------------------------------------------------------------------
  421.  
  422. void FW_CNativeControl::Draw(Environment* ev, ODFacet* facet, ODShape* invalidShape)
  423. {
  424. #ifdef FW_BUILD_MAC
  425.     FW_CViewContext gc(ev, this, facet, invalidShape);
  426.  
  427.     FW_CPlatformPoint qdPoint = gc.LogicalToDevice(FW_kZeroPoint);
  428.     FW_CPlatformPoint qdSize = GetSize(ev).AsPlatformPoint();
  429.     fControlHelper->Draw(ev, facet, qdPoint, qdSize);
  430. #endif
  431.  
  432. #ifdef FW_BUILD_WIN
  433.     FW_UNUSED(facet); 
  434.     FW_UNUSED(invalidShape);
  435.     // Windows handles updating controls automatically
  436. #endif
  437. }
  438.  
  439. //----------------------------------------------------------------------------------------
  440. // FW_CNativeControl::DoMouseDown
  441. //----------------------------------------------------------------------------------------
  442.  
  443. FW_Handled FW_CNativeControl::DoMouseDown(Environment *ev, const FW_CMouseEvent& theMouseEvent)
  444. {
  445. #ifdef FW_BUILD_MAC
  446.     ODFacet* odFacet = theMouseEvent.GetFacet(ev);
  447.     FW_CViewContext vc(ev, this, odFacet);
  448.     
  449.     FW_CPoint canvasWhere = theMouseEvent.GetMousePosition(ev, FW_CMouseEvent::kWindow);
  450.     
  451.     {
  452.         // Take into account the origin offset for pattern alignment. [AMB]
  453.         FW_CAcquiredODTransform aqTransform(odFacet->CreateTransform(ev));
  454.  
  455.         ODPlatformCanvas plfmCanvas = vc.GetPlatformCanvas();
  456.         FW_CPoint offset(FW_IntToFixed(plfmCanvas->portRect.left),
  457.                         FW_IntToFixed(plfmCanvas->portRect.top));
  458.         
  459.         ODPoint odOffset = offset;
  460.         aqTransform->MoveBy(ev, &odOffset);
  461.         
  462.         canvasWhere.Transform(ev, aqTransform);
  463.     }
  464.     
  465.     fControlHelper->MouseDown(ev, vc, canvasWhere.AsPlatformPoint());
  466.     return FW_kHandled;
  467. #endif
  468.  
  469. #ifdef FW_BUILD_WIN
  470. FW_UNUSED(theMouseEvent);
  471.     // Windows handles mouse events automatically
  472.     return FALSE;
  473. #endif
  474. }
  475.  
  476. //----------------------------------------------------------------------------------------
  477. // FW_CNativeControl::Disable
  478. //----------------------------------------------------------------------------------------
  479. void FW_CNativeControl::Disable(Environment* ev)
  480. {
  481.     if (IsEnabled(ev))
  482.     {
  483.         // Call inherited
  484.         FW_MEventHandler::Disable(ev);
  485.         
  486.         if (GetFrame(ev)->PrivSubViewsCreated(ev))
  487.         {
  488.             FW_CPlatformPoint qdSize    = GetSize(ev).AsPlatformPoint();
  489.         
  490.             FW_CFrameFacetIterator ite(ev, GetFrame(ev));
  491.             for  (ODFacet* facet = ite.First(ev); ite.IsNotComplete(ev); facet = ite.Next(ev))
  492.             {
  493.                 FW_CViewContext vc(ev, this, facet);
  494.                 FW_CPlatformPoint qdPoint    = vc.LogicalToDevice(FW_kZeroPoint);
  495.                 
  496.                 fControlHelper->Enable(false, qdPoint, qdSize);
  497.             }
  498.         }
  499.         else 
  500.             fControlHelper->Enable(false);    // avoid drawing
  501.     }
  502. }
  503.  
  504. //----------------------------------------------------------------------------------------
  505. // FW_CNativeControl::Enable
  506. //----------------------------------------------------------------------------------------
  507. void FW_CNativeControl::Enable(Environment* ev)
  508. {
  509.     if (!IsEnabled(ev))
  510.     {
  511.         // Call inherited
  512.         FW_MEventHandler::Enable(ev);
  513.     
  514.         if (GetFrame(ev)->PrivSubViewsCreated(ev))
  515.         {
  516.             FW_CPlatformPoint qdSize    = GetSize(ev).AsPlatformPoint();
  517.         
  518.             FW_CFrameFacetIterator ite(ev, GetFrame(ev));
  519.             for  (ODFacet* facet = ite.First(ev); ite.IsNotComplete(ev); facet = ite.Next(ev))
  520.             {
  521.                 FW_CViewContext vc(ev, this, facet);
  522.                 FW_CPlatformPoint qdPoint    = vc.LogicalToDevice(FW_kZeroPoint);
  523.                 
  524.                 fControlHelper->Enable(true, qdPoint, qdSize);
  525.             }
  526.         }
  527.         else 
  528.             fControlHelper->Enable(true);    // avoid drawing
  529.     }
  530. }
  531.  
  532. //----------------------------------------------------------------------------------------
  533. // FW_CNativeControl::SetVisible
  534. //----------------------------------------------------------------------------------------
  535.  
  536. void FW_CNativeControl::SetVisible(Environment* ev, FW_Boolean visible, FW_Boolean propagate)
  537. {
  538.     FW_CView::SetVisible(ev, visible, propagate);
  539.     
  540.     if (visible)
  541.         fControlHelper->Show();
  542.     else
  543.         fControlHelper->Hide();        
  544. }
  545.  
  546. //----------------------------------------------------------------------------------------
  547. // FW_CNativeControl::RedrawControl
  548. //----------------------------------------------------------------------------------------
  549. // Used to refresh a scrollbar for instance
  550.  
  551. void FW_CNativeControl::RedrawControl(Environment* ev)
  552. {
  553.     FW_CPlatformPoint qdSize    = GetSize(ev).AsPlatformPoint();
  554.  
  555.     FW_CFrameFacetIterator ite(ev, GetFrame(ev));
  556.     for  (ODFacet* facet = ite.First(ev); ite.IsNotComplete(ev); facet = ite.Next(ev))
  557.     {
  558.         FW_CViewContext vc(ev, this, facet);
  559.         FW_CPlatformPoint qdPoint    = vc.LogicalToDevice(FW_kZeroPoint);
  560.         
  561.         fControlHelper->Hide();    
  562.         fControlHelper->Show(qdPoint, qdSize);
  563.     }
  564. }
  565.  
  566. //----------------------------------------------------------------------------------------
  567. // FW_CNativeControl::LocationChanged
  568. //----------------------------------------------------------------------------------------
  569.  
  570. void FW_CNativeControl::LocationChanged(Environment* ev, const FW_CPoint &oldLocation)
  571. {
  572.     FW_CControl::LocationChanged(ev, oldLocation);
  573.     
  574. #ifdef FW_BUILD_WIN
  575.     FW_CViewContext fc(ev, this, GetFrame(ev)->GetActiveFacet(ev));
  576.     
  577.     FW_CPlatformPoint wndLocation = fc.ContentToCanvas(GetLocation(ev));
  578.     FW_CPlatformPoint wndSize = fc.ContentToCanvas(GetSize(ev).x, GetSize(ev).y);
  579.     fControlHelper->Move(wndLocation, wndSize);
  580. #endif
  581. }
  582.  
  583. //----------------------------------------------------------------------------------------
  584. // FW_CNativeControl::SizeChanged
  585. //----------------------------------------------------------------------------------------
  586.  
  587. void FW_CNativeControl::SizeChanged(Environment* ev, const FW_CPoint &oldSize)
  588. {
  589.     FW_CControl::SizeChanged(ev, oldSize);
  590.     
  591. #ifdef FW_BUILD_WIN
  592.     FW_CViewContext fc(ev, this, GetFrame(ev)->GetActiveFacet(ev));
  593.     
  594.     FW_CPlatformPoint wndLocation = fc.ContentToCanvas(GetLocation(ev));
  595.     FW_CPlatformPoint wndSize = fc.ContentToCanvas(GetSize(ev).x, GetSize(ev).y);
  596.     fControlHelper->Move(wndLocation, wndSize);
  597. #endif
  598. }
  599.  
  600. //----------------------------------------------------------------------------------------
  601. //    FW_CNativeControl::Flatten
  602. //----------------------------------------------------------------------------------------
  603.  
  604. void    FW_CNativeControl::Flatten(Environment*ev, FW_CWritableStream& stream) const
  605. {
  606.     FW_CControl::Flatten(ev, stream);
  607. }
  608.  
  609. //----------------------------------------------------------------------------------------
  610. //    FW_CNativeControl::InitializeFromStream
  611. //----------------------------------------------------------------------------------------
  612.  
  613. void    FW_CNativeControl::InitializeFromStream(Environment*ev, FW_CReadableStream& stream)
  614. {
  615.     FW_CControl::InitializeFromStream(ev, stream);
  616. }    
  617.  
  618. //========================================================================================
  619. //    CLASS FW_CControlNotification
  620. //========================================================================================
  621.  
  622. FW_DEFINE_CLASS_M1(FW_CControlNotification, FW_CNotification)
  623.  
  624. //----------------------------------------------------------------------------------------
  625. // FW_CControlNotification::FW_CControlNotification
  626. //----------------------------------------------------------------------------------------
  627.  
  628. FW_CControlNotification::FW_CControlNotification(FW_CControl* control, FW_Message inMsg) :
  629.     FW_CNotification(),
  630.     fControl(control)
  631. {
  632.     // Create an interest using the control message by default
  633.     FW_SOMEnvironment ev;    
  634.     FW_Message msg = (inMsg != 0) ? inMsg : control->GetMessage(ev);
  635.         
  636.     SetInterest(FW_CInterest((FW_MNotifier*)control, msg));
  637. }
  638.  
  639. //----------------------------------------------------------------------------------------
  640. // FW_CControlNotification::FW_CControlNotification
  641. //----------------------------------------------------------------------------------------
  642.  
  643. FW_CControlNotification::FW_CControlNotification(const FW_CControlNotification& other) :
  644.     FW_CNotification(other),
  645.     fControl(other.fControl)
  646. {
  647. }
  648.  
  649. //----------------------------------------------------------------------------------------
  650. // FW_CControlNotification::~FW_CControlNotification
  651. //----------------------------------------------------------------------------------------
  652.  
  653. FW_CControlNotification::~FW_CControlNotification()
  654. {
  655. }
  656.  
  657. //----------------------------------------------------------------------------------------
  658. // FW_CControlNotification::operator=
  659. //----------------------------------------------------------------------------------------
  660.  
  661. FW_CControlNotification& FW_CControlNotification::operator=(const FW_CControlNotification& other)
  662. {
  663.     if (this != &other)
  664.     {
  665.         FW_CNotification::operator=(other);
  666.         fControl = other.fControl;
  667.     }
  668.     return *this;
  669. }
  670.  
  671. //----------------------------------------------------------------------------------------
  672. // FW_CControlNotification::operator==
  673. //----------------------------------------------------------------------------------------
  674.  
  675. FW_Boolean FW_CControlNotification::operator==(const FW_CControlNotification& other) const
  676. {
  677.     return FW_CNotification::operator==(other) && fControl == other.fControl;
  678. }
  679.  
  680.  
  681.